demo: Link against Harfbuzz
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 26 Jan 2016 11:46:48 +0000 (11:46 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Tue, 26 Jan 2016 11:46:48 +0000 (11:46 +0000)
The font features demo started calling the Harfbuzz API directly
starting from commit 9de3b24c205f1c647292a490f92f21a776b931a4. Harfbuzz
is an implicit dependency of Pango on some platforms, but it's not part
of the public dependencies; this means that we cannot expect to link to
Pango and automatically get Harfbuzz symbols to link against —
especially when things like --as-needed are in play.

This change triggered build failures on non-Unix platforms, fixed by
commit 2a9967731a3b77b102ada633c39b5a35efc80957, as well as build
failures in Continuous, with this error message:

/usr/lib/gcc/x86_64-gnomeostree-linux/4.9.3/../../../../x86_64-gnomeostree-linux/bin/ld:
font_features.o: undefined reference to symbol 'hb_tag_to_string'
//lib/libharfbuzz.so.0: error adding symbols: DSO missing from command
line
collect2: error: ld returned 1 exit status

In order to get the font features demo to build everywhere we should
take an explicit, though optional, check on Harfbuzz, and conditionally
build the font features demo with the right compiler and linker flags.

configure.ac
demos/gtk-demo/Makefile.am

index c15aaa933e06709c13fd0b38a762bdb157e585d3..3ff4615596d65c98f9839711f7c06e351a4e5fe1 100644 (file)
@@ -1690,6 +1690,15 @@ if test "$have_colord" = "yes"; then
 fi
 AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
 
+##################################################
+# Check for harfbuzz
+##################################################
+
+PKG_CHECK_MODULES(HARFBUZZ, harfbuzz >= 0.9, have_harfbuzz=yes, have_harfbuzz=no)
+AC_SUBST(HARFBUZZ_CFLAGS)
+AC_SUBST(HARFBUZZ_LIBS)
+AM_CONDITIONAL(BUILD_FONT_DEMO, [ test "x$have_harfbuzz" = xyes ])
+
 ##################################################
 # Checks for gtk-doc and docbook-tools
 ##################################################
index 64cc8c4d71b8ca1599a75ee7c4b9ce3bacb7ca81..60e4e13d394058428101bf87f450fc8e3e707123 100644 (file)
@@ -70,12 +70,18 @@ demos_base =                                        \
        transparent.c                           \
        tree_store.c
 
+demos_opt =
+
+if BUILD_FONT_DEMO
+demos_opt += font_features.c
+endif
+
 if OS_UNIX
-demos = $(demos_base) font_features.c pagesetup.c
-else
-demos = $(demos_base)
+demos_opt += pagesetup.c
 endif
 
+demos = $(demos_base) $(demos_opt)
+
 AM_CPPFLAGS = \
        -I$(top_srcdir)                         \
        -I$(top_builddir)/gdk                   \
@@ -94,6 +100,11 @@ LDADDS = \
        $(GDK_DEP_LIBS)                         \
        -lm
 
+if BUILD_FONT_DEMO
+AM_CPPFLAGS += $(HARFBUZZ_CFLAGS)
+LDADDS += $(HARFBUZZ_LIBS)
+endif
+
 bin_PROGRAMS = gtk3-demo gtk3-demo-application
 
 desktopdir = $(datadir)/applications